//
//  ViewController.m
//  KeyBoard
//
//  Created by MyMac on 15/10/23.
//  Copyright © 2015年 tongfang. All rights reserved.
//

#import "ViewController.h"
#import "CustomTool.h"
#import "FirstVC.h"
@interface ViewController ()
@property(nonatomic,strong)UITextField*t;
@property(nonatomic,assign)CGRect oldRect;
@property(nonatomic,strong)CustomTool*tool;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UITextField*filed=[[UITextField alloc]initWithFrame:CGRectMake(0, self.view.bounds.size.height-44, self.view.bounds.size.width, 44)];
    filed.backgroundColor=[UIColor redColor];
    [self.view addSubview:filed];
    CGRect oldRect=filed.frame;
    CGRect selfRect=self.view.frame;
    
    
    
    UIButton*btn=[[UIButton alloc]initWithFrame:CGRectMake(0, 100, 50, 60)];
    btn.backgroundColor=[UIColor greenColor];
    [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    self.tool=[[CustomTool alloc]init];
//   [[CustomTool shareCustomTool] toolKeyBoardShowAndHideOperatuonWithshowOPeration:^(CGRect keyBoardFrame, CGFloat animationDuration, NSDictionary *userInfo) {
//       [UIView animateWithDuration:animationDuration animations:^{
//                    filed.frame=CGRectMake(0,selfRect.size.height-filed.bounds.size.height-keyBoardFrame.size.height,selfRect.size.width, filed.bounds.size.height);
//}];
//
// } hideOPeration:^(CGRect keyBoardFrame, CGFloat animationDuration, NSDictionary *userInfo) {
//     [UIView animateWithDuration:animationDuration animations:^{
//         filed.frame=oldRect;
//     }];
//
//     
//
// }];
[CustomTool keyBoardAddObserver:self showBlcok:^(CGRect keyBoardBounds, CGFloat animationDuration, NSDictionary *userIfon) {
    
} hideBlock:^(CGRect keyBoardBounds, CGFloat animationDuration, NSDictionary *userIfon) {
    
}];
}
-(void)btnClick{
    FirstVC*vc=[[FirstVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];


}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
    

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
